//
// Created by francklinson on 2021/12/2 AT 9:37.
// May Saint Diana bless you!
//

#include <iostream>
#include <algorithm>
#include <string>

using namespace std;

class Solution {
public:
    int maximum69Number(int num) {
        string x = to_string(num);
        for (char & i : x) {
            // 找到第一个6 并改为9
            if (i=='6') {
                i = '9';
                break;
            }
        }
        return stoi(x);
    }
};

int main() {
    Solution solution;
    cout << solution.maximum69Number(9669) << endl;
    cout << solution.maximum69Number(9999) << endl;
    cout << solution.maximum69Number(9969) << endl;
    return 0;
}

